package com.itheima.stringbuilderdemo;

import java.util.Scanner;

public class StringBuilderDemo4 {
    public static void main(String[] args) {
        //对称字符串
        //对称
        //abc
        //正着和反着是一样的
        //1.键盘录入一个字符串
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串");
        String str = sc.next();

        //2.反转键盘录入的字符串
        //String result = new StringBuilder().append(str).reverse().toString();
        StringBuilder sb = new StringBuilder();
        sb.append(str);
        sb.reverse();

        String result  = sb.toString();
        System.out.println(result);

        //3.比较
        if(str.equals(result)){
            System.out.println("当前字符串是对称字符串");
        }else{
            System.out.println("当前字符串不是对称字符串");
        }
    }
}
